package http.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;

import java.lang.annotation.Annotation;
import java.util.Map;

public class ApplicationContextUtil {
    private static ApplicationContext context;

    public static <T> T  getBean(Class<T> clazz) {
       return context.getBean(clazz);
    }
    public static void setContext(ApplicationContext context) {
        ApplicationContextUtil.context = context;
    }

    public static Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) throws BeansException{
        return context.getBeansWithAnnotation(annotationType);
    }






}
